﻿<?php
	include("include/global.php");
	function getStatus($str)
	{	
		if($str=='WAIT_BUYER_PAY')
		   $getStatus = "等待买家付款";
		else if($str=='WAIT_SELLER_SEND_GOODS')
		   $getStatus = "买家已付款,等待卖家发货";
		else if($str=='WAIT_BUYER_CONFIRM_GOODS')
		   $getStatus = "卖家已发货,等待买家确认收货";		   
		else if($str=='TRADE_BUYER_SIGNED')
		    $getStatus = "买家已签收,货到付款专用";
		else if($str=='TRADE_FINISHED')
		    $getStatus = "交易成功";
		else if($str=='TRADE_CLOSED')
		    $getStatus = "交易关闭";						
		else
			$getStatus = "交易被淘宝关闭";
		return $getStatus;
	}

?>	
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>数据库内容</title>
<link href="css/list.css" rel="stylesheet" type="text/css" />
<script src=js/colors.js></script>
</head>
<body>
<table align=center border=0 cellspacing=1 cellpadding=5 width="95%" class="list">

 <tr>
	<td>编号</td>
    <td>标题</td>
    <td>状态</td>
    <td>操作</td>        
 </tr>    
<?php
	$pagesize=20;//分页大小
	$sql="";
	$sql = 'SELECT * FROM `'.PRE.'order`';
	$arr=get_page_num($sql,$pagesize);
	$sql.=" LIMIT $arr[1], $pagesize";
	$rs=$db->query($sql) or die("文章列表出错！");
	while($row = $db->fetch_array($rs)){	
?>
 <tr>
   <td><?php echo $row['tid']?></td>
   <td><?php echo $row['title']?></td>  
   <td><?php echo getStatus($row['status'])?></td>
   <td>
   <?php 
   if ($row['status']=='WAIT_SELLER_SEND_GOODS'){
   echo '<a href="taobao.delivery.send.php?tid='.$row['tid'].'" target="_blank">发货</a>';
   }else{
   echo '已发货';
   }
   ?>
   </td>           
 </tr>
 <?php
	}
 ?>
 <tr>
   <td colspan="2" class='page_h'>
 <?php
 	new page($arr[0],$pagesize);
 ?>
   </td>
  </tr>
</table>   
</body>
</html>